#!/usr/bin/env ruby
# -*- encoding : utf-8 -*-

require 'bunny'

# RJ.configure { |c|
#   c.queue "failover_test"
#   c.server "amqp://localhost/bunny"
# }


b = Bunny.new "amqp://localhost/bunny", heartbeat: 2, threaded: true, automatically_recover: true
b.start
channel = b.create_channel
channel.prefetch(1)
queue = channel.queue("hello", durable: true)

queue.subscribe do |delivery_info, properties, payload|
  puts "got #{payload}"
end

loop do
  sleep 0.1
end
